package com.woniu.cms.goods.core.controller;


import com.woniu.cms.goods.core.entity.GoodsInventory;
import com.woniu.cms.goods.core.mapper.GoodsInventoryMapper;
import com.woniu.cms.goods.core.service.IGoodsInventoryService;
import com.woniu.cms.goods.core.service.IGoodsSummaryService;
import com.woniu.common.api.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 当月库存盘点表 前端控制器
 * </p>
 *
 * @author romantic sheep
 * @since 2022-09-20
 */
@RestController
@Api(tags = "库存盘点模块")
@RequestMapping("/goods-inventory")
public class GoodsInventoryController {

    @Autowired
    private IGoodsInventoryService inventoryService;
    /*
    * 当月库存盘点
    * @storeName，仓库名称
    * @materialType，材料供应类型（0-甲供，1-乙供）
    * */
    @ApiOperation("查询/统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "storeName",value = "仓库名称"),
            @ApiImplicitParam(name = "materialType",value = "材料供应类型（0-甲供，1-乙供）")
    })
    @GetMapping("count")
    public Result countInventory(String storeName,Integer materialType){
        List<GoodsInventory> list = inventoryService.countInventory(storeName,materialType);
        Map map = new HashMap();
        map.put("data",list);
        return Result.common(map);
    }
}

